var WxParse = require('../../common/wxParse/wxParse.js');
var App = getApp();
Page({
  data: {
      detail: {},
      cartCount: 0,
      reviews: {},
      specificationArray: [],
      indicatorDots: true,
      autoplay: false,
      interval: 3000,
      duration: 1000,
      tabs: ["商品详情",  "商品评价"],
      activeIndex: 0,
      num: 1, // 商品数量
      minusStatuses: '',
      flag: 0,
      firstIndex: -1,
      attrValueList: [],
      productId: ''
  },
  onLoad (param) {
    this.setData({productId: param.id}) // 商品id
    this.getIntDtail(param.id)
  },
  getIntDtail (id) { // 积分商品详情
    App.HttpService.intDtail({id: id}).then(res => {
      let data = res.data
      if (data.code == 200) {
        this.setData({detail: data.data})
    
        WxParse.wxParse('article', 'html', data.data.introduction, this, 5)  
     
      }
    })
  },
  toConfirm () {
    let { detail } = this.data
    detail.num = 1
    wx.setStorageSync('integral', detail)
    wx.navigateTo({
      url: '/pages/integral-mall/confirm/index'
    })
  },
})